import { Component, OnInit } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { Router, ActivatedRoute } from '@angular/router';

@Component({
  selector: 'app-prescriptions-remarks',
  templateUrl: './prescriptions-remarks.component.html',
  styleUrls: ['./prescriptions-remarks.component.scss']
})
export class PrescriptionsRemarksComponent implements OnInit {
  id: string;
  overproofList: any[] = [];
  tabooList: any[] = [];
  repetitionList: any[] = [];
  auditList: any[] = [];
  constructor(private http: HttpClient, private activatedRoute: ActivatedRoute) { }

  ngOnInit() {
    this.activatedRoute.queryParams.subscribe(queryParams => {
			// 判断是事前还是事后的审方
			this.id = queryParams.infoMessage;
			// let title = queryParams.title;
    });
    this.http.get(window.API_ROOT + 'api/recipes/' + this.id ).subscribe((res: any) => {
      console.log('res_', res);
      this.overproofList = res.data['药量超标明细'];
      this.tabooList = res.data['配伍禁忌明细'];
      this.repetitionList = res.data['药物重复明细'];
      this.auditList = res.data['人工审核记录'];
    });
  }

}
